<template>
  <div class="register-box">
    <el-form
      :model="registerForm"
      :rules="registerRules"
      v-loading="loading"
      ref="registerForm"
      size="small"
      label-width="auto"
    >
      <el-row :gutter="20">
        <el-col :span="24">
          <el-form-item label="姓名:" prop="contactsName">
            <el-input
              class="haruyuki-width-100"
              type="text"
              v-model="registerForm.contactsName"
              :disabled="isRegDisabled"
              placeholder="请输入姓名"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="联系方式:" prop="contactsPhone">
            <el-input
              class="haruyuki-width-100"
              type="text"
              v-model="registerForm.contactsPhone"
              :disabled="isRegDisabled"
              placeholder="请输入联系方式"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="24" v-if="regType === 'add'">
          <el-form-item label="SN:" prop="posSn">
            <el-input
              class="haruyuki-width-100"
              type="text"
              v-model="registerForm.posSn"
              :disabled="isRegDisabled"
              placeholder="请输入SN号"
            ></el-input>
          </el-form-item>
        </el-col>
        <!-- <el-col :span="24" v-if="regType === 'add'">
          <el-form-item label="通道选择:" prop="aisleCode">
            <el-select
              class="haruyuki-width-100"
              size="small"
              v-model="registerForm.aisleCode"
              :disabled="isRegDisabled"
              placeholder="请选择变更类型"
            >
              <el-option
                v-for="item in aisleList"
                :key="item.aisleCode"
                :label="item.aisleName"
                :value="item.aisleCode"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-col> -->
      </el-row>
    </el-form>
  </div>
</template>

<script>
// import { getSelectAisleList } from "@/api/rb-service/store/store";
import { isMobile } from "@/util/validate";

export default {
  props: {
    registerForm: {
        type: Object,
        default: () => {
            return {
                rpiNo:  "",
                contactsName:  "",
                contactsPhone:  "",
                posSn:  "",
                // aisleCode:  "",
            }
        },
    },
    isRegDisabled: {
      type: Boolean,
      default: false,
    },
    rpiNo: {
      type: String,
      default: ""
    },
    regType: {
      type: String,
      default: ""
    }
  },
  components: {
  },
  data() {
    const validatePhone = (rule, value, callback) => {
      if (value === "") {
        callback(new Error("请输入联系方式"));
      } else if (!isMobile(value)) {
        callback(new Error("手机号码不正确！"));
      } else {
        callback();
      }
    };
    return {
      labelData: {
        merchantTitle: "商户信息",
        contentTitle: "",
      },
      loading: false,
      // aisleList: [],
      registerRules: {
        contactsName: [{ required: true, message: "请输入姓名", trigger: "blur" }],
        contactsPhone: [{ required: true, validator: validatePhone, trigger: "blur" }],
        posSn: [{ required: true, message: "请输入SN号", trigger: "blur" }],
        // aisleCode: [
        //   { required: true, message: "请选择通道", trigger: "blur" },
        // ],
      },
      isShow: true,
    };
  },
  computed: {
  },
  watch: {
    
  },
  created() {
    if (this.rpiNo) {
      this.registerForm.rpiNo = this.rpiNo;
    }
    // this.getAisle();
  },
  methods: {
    // /* 获取通道列表数据 */
    // getAisle() {
    //   getSelectAisleList().then((res) => {
    //     this.aisleList = res.data.data;
    //   });
    // },
  },
};
</script>

<style lang="scss" scoped>
.register-box {
  // padding: 20px 40px 20px 0;
  padding: 20px;
  display: flex;
  justify-content: center;
  .register-box-title {
    font-size: 18px;
    text-align: center;
    margin-bottom: 20px;
  }
}
.alter-title {
  font-size: 16px;
  font-weight: bold;
  margin-left: 20px;
}

.upload-img {
  overflow: hidden;
  background-color: #fff;
  border: 1px solid #c0ccda;
  border-radius: 6px;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  width: 148px;
  height: 148px;
  margin: 0 8px 8px 0;
  display: inline-block;
}
</style>